/**
 * Candidate number: 35834
 */
package tv.starfu.sequencer.components;

import com.artemis.Component;
import net.beadsproject.beads.core.AudioContext;
import net.beadsproject.beads.ugens.Envelope;

public class PitchBend extends Component {
    private float startVal;
    private float endVal;
    private float curvature;
    private int duration;
    
    private Envelope envelope;
    private AudioContext ac;

    public PitchBend(float startVal, float endVal, float curvature, int duration, AudioContext ac) {
        this.startVal = startVal;
        this.endVal = endVal;
        this.curvature = curvature;
        this.duration = duration; 
        this.ac = ac;
        createEnvelope();
    }
    
    public final void createEnvelope() {       
        Envelope e = new Envelope(ac, startVal);
        e.addSegment(endVal, duration, curvature);
        this.envelope = e;
    }

    public AudioContext getAc() {
        return ac;
    }

    public void setAc(AudioContext ac) {
        this.ac = ac;
    }

    public float getCurvature() {
        return curvature;
    }

    public void setCurvature(float curvature) {
        this.curvature = curvature;
        createEnvelope();
    }

    public int getDuration() {
        return duration;
    }

    public void setDuration(int duration) {
        this.duration = duration;
        createEnvelope();
    }

    public float getEndVal() {
        return endVal;
    }

    public void setEndVal(float endVal) {
        this.endVal = endVal;
        createEnvelope();
    }

    public Envelope getEnvelope() {
        return envelope;
    }

    public void setEnvelope(Envelope envelope) {
        this.envelope = envelope;
        createEnvelope();
    }

    public float getStartVal() {
        return startVal;
    }

    public void setStartVal(float startVal) {
        this.startVal = startVal;
        createEnvelope();
        
    }
    
    
    
    
    
}
